home *** CD-ROM | disk | FTP | other *** search
/ Commodore 64 Scene Diskmags Assortment / Commodore_CEE_Vol._1_Issue_05_1995_Jack_Vander_White_Disk_1_of_3_Side_B.d64 / drive bit 1 < prev    next >
Text File  |  2023-02-26  |  22KB  |  324 lines

  1. Drive identify prg
  2.  
  3. From : Rod Gasson
  4.  
  5.     In recent weeks (as many will know) several people have asked about how to determine the different disk drives that we have available to us.
  6.  
  7. Several methods, and example programs have been posted in response to these questions, but alas, none of them have been "complete", in that they recognise some drives, but not all of them..  not to mention the fact that none of those that I've seen have attempted to identify a CMD drive in its emulation modes.
  8.  
  9. Although all the required information is readily available, in the form of programs such as POLLDEVS and WHEREAMI by Doug Cotton and others, it appears that no one has collaborated all this information into a single program..  until now :-)
  10.  
  11. What follows is just something that I cooked up as an aid to the fledgling programmers out there..  please feel free to use and distribute this program in any way you see fit..   It will detect the following drive types...  1541, 1571, 1581, CMD HD, FDxx, Ramdrive and Ramlink, and for the more adventurous among you, Paul Gardner-Stevens 64net.
  12.  
  13. With the CMD drives it will also report the following partition types.. Native, 1541, 1571, 1581, CP/M (HD only) and DACC partitions.
  14.  
  15. If anyone knows reliable ways to detect drives such as the Lt.Kernal, Datachief, SFD1001, or any other drive PLEASE forward this information to me so that I can update this program to make it the definitive drive detection program.
  16.  
  17. Enjoy.
  18.  
  19.  
  20. ---   Text Import Start   --- 
  21.  
  22. 10 rem ***** identify disk drives *****  rod gasson 21/11/95 
  23. 20  : 
  24. 30 for dv=8 to 16 
  25. 40  : 
  26. 50 open15,dv,15 : close15 : 
  27. 60 if st= -128  then print "device"dv"Not online"  : goto420 
  28. 70  : 
  29. 80 open 15,dv,15 
  30. 90 print#15,"m-r"chr$(164)chr$(254)chr$(2) : get#15,a$,b$ 
  31. 100  : 
  32. 110 print chr$(14)"device"dv"is a"; 
  33. 120  : 
  34. 130 if a$="h" and b$= "d" then  print" CMD Hard Drive";  : goto190 
  35. 140 if a$="r" and b$= "d" then  print" CMD Ram Drive";  : goto190 
  36. 150 if a$="f" and b$= "d" then  print" CMD FDxx";      : goto190 
  37. 160 if a$="r" and b$= "l" then  print" CMD Ramlink";   : goto190 
  38. 170 goto 310 
  39. 180  : 
  40. 190 print " in "; 
  41. 200  : 
  42. 210 print#15,"g-p"  :  get#15,x$ :  x=asc(x$+chr$(0)) 
  43. 220  : 
  44. 230 if x=1 then print  "Native"; 
  45. 240 if x=2 then print  "1541 emulation"; 
  46. 250 if x=3 then print  "1571 emulation"; 
  47. 260 if x=4 then print  "1581 emulation"; 
  48. 270 if x=5 then print  "CP/M emulation"; 
  49. 280 if x=7 then print  "DACC"; 
  50. 290 print " mode"  :  goto420 
  51. 300  : 
  52. 310 print#15,"m-r"chr$(233)chr$(166)chr$(2) : get#15,a$,b$ 
  53. 320 if a$="8" and b$= chr$(177) then print" 1581"   : goto420 
  54. 330  : 
  55. 340 print#15,"m-r"chr$(198)chr$(229)chr$(2) : get#15,a$,b$ 
  56. 350  : 
  57. 360 if a$="4" and b$= chr$(177) then print" 1541"    : goto420 
  58. 370 if a$="7" and b$= chr$(177) then print" 1571"    : goto420 
  59. 380 if a$="8" and b$= chr$(182) then print" 64 net"  : goto420 
  60. 390  : 
  61. 400 print "unknown drive" 
  62. 410  : 
  63. 420 close15  : next 
  64.  
  65. ---   Text Import End   ---
  66.  
  67. --------------------------- 
  68. Drivetype Detection
  69.  
  70. From : Rod Gasson
  71.  
  72. Myke Carter writes:
  73.  
  74.  MC> I'm confused about how to glean a six-character string of text from a single address in a drive-ROM.
  75.  
  76. This info is in the user guide of most (all?) CBM disk drives, but since it is so short and easy, I'll save you the trouble of looking (assuming you have such a guide).
  77.  
  78. 10 open 15,dv,15     :rem open command channel 
  79. 20 print#15, "m-r"chr$(<address)chr$(>address)chr$(# of bytes) 
  80. 30 get#15, <byte>,<byte>,<byte>   ....  etc 
  81. 40 close 15
  82.  
  83. So if you wanted to read 6 bytes from $fea0, you first need to determine the low and high bytes of $ffe0 ...  in decimal.
  84.  
  85. $ffe0  has a high byte of $ff, and a low byte of $e0 ..  converted to decimal, this is highbyte=255, low byte = 224
  86.  
  87. If we insert this into line #20, it will look like
  88.  
  89. 20 print#15, "m-r"chr$(224)chr$(255)chr$(6)
  90.                        ^^^      ^^^      ^
  91.                        low     high      # of chars.
  92.  
  93. Since you have told it to read 6 bytes, you need to GET them.. so line 30 will then read
  94.  
  95. 30 get#15, a$,b$,c$,d$,e$,f$
  96.  
  97. You can of course use a loop to read the six bytes, but this way makes it easier to see what you are doing.
  98.  
  99. That is all there is to it really...  to read other locations of the drive memory you simple change the two address bytes, plus te number of bytes you wish to read.
  100.  
  101.  MC> When he suggests looking for "CMD xx" at $FEA0, I'm left to assume that I should establish a string-building loop which reads from addresses $FEA0, $FEA1, $FEA2, $FEA3, $FEA4, and $FEA5.
  102.  
  103. You assume correctly.
  104.  
  105.  MC> Or perhaps I should only read from $FEA4 and $FEA5 because if the 4, 7, and 8 tests are performed first and fail
  106.  
  107. I don't have Ed's code handy at the moment, so I can't say.
  108.  
  109.  MC> cannot the "CMD " portion be assumed?  At any
  110.  
  111. Possibly, and even probably...  However, the idea is to *correctly* identify the drive type at all times, and since this "CMD" identifier is a known constant for CMD drives, then why not play it safe and use it ?    I know what you are getting at though, and like I say, you are probably correct..  'Course, you could also just read one byte at $FEA4 (Eds values) and if it is a "C" then assume it is a CMD device.. But who knows, at some stage in the future (or past) there may be another (non-CMD drive) that also happens to return this value at this location.
  112.  
  113.  MC> rate, reading from drive-ROMs is a relatively new thing for me and it would just be so much more helpful to actually have a sample program to look at along with the list that Ed sent.
  114.  
  115. As you can see, a "sample" program consists of just a few lines..  how much you expand on this is up to you..  Remember though that you will be looking at different locations for different "identifiers" for the different drives, so you WILL need to do more than one m-r for each of the drive types you are attempting to identify..  The example that Russell posted is really nothing more than my few lines above, that has been expanded out to cater for the different drives that it detects. To add Ed's CMD info is just a matter of expanding that a little further.
  116.  
  117.  MC> suggested method.  It's just easier for me to have something to RUN and work with the first time around.
  118.  
  119. Which is why I have opted to give you the absolute minimum example possible..  if you can follow those few lines above, the rest will tend to fall into place (he says hopefully).
  120.  
  121.  MC> RG> My *personal* advice, since you don't have a CMD drive is to not consider them at all.
  122.  
  123.  MC> That has basically been my attitude all along but since I have learned the BASICs of using direct access commands to manipulate disk data, I have less difficulty imagining what is actually happening inside an emulation partition (as far as my programming is concerned) and if I can at all avoid an obvious mistake that could render my program incompatible with a CMD device, I'll do it.
  124.  
  125. As I said once before, one of the nice things about the CMD drives is that the average programmer doesn't have to take any special steps to cater for them...   to take full advantage of them is a different story though.    Leave that until you get one..
  126.  
  127.  MC> RE: What is an "excelerator plus"...?
  128.  
  129. MC> RG> It is a 1541 "clone".
  130.  
  131. MC> I have since learned that it is an FSD-2 drive.  I am vaguely familiar
  132.  
  133. Yup, but the DOS (which is what you are interested in) is no different than a regular '41
  134.  
  135.  MC> RE: head "chatter" when accessing side 2 of a 1571 disk
  136.  MC>
  137.  MC> I can't say I've never noticed this head "chatter" you refer to coming from my drive.  Is it just a cosmetic
  138.  
  139. I'd say cosmetic..  but I dunno enough about what is really going on, or what the fix was to say for sure.
  140.  
  141.  MC> thing or should I seriously look into getting my old ROMS upgraded? Would Jiffy-DOS do the trick (because I'm already preparing to upgrade it that way)?
  142.  
  143. Yes, JiffyDos has the bugfix code in the ROMS, and this is definitly the way to go...  I certainly wouldn't recommend spending out on a straight DOS upgrade...  JiffyDos is well worth the expense though.
  144.  
  145.  MC> RG> send a series of block-read commands to the drives and read the error channel.
  146.  
  147.  MC> This was the first thing I tried although I don't think I checked the error channel after I sent the commands.
  148.  
  149. <hehehehehe>,  this reminds me of one of my first programming puzzles.. I wrote this real gee-whizz program (forget what it was), that had lots of DATA statements, but it took me ages to figure out why it didn't work..  I never realised that I had to READ these DATA strings into variables..  <gee, how embarrassing>.  I still have a note scribbled in my C128 user guide, that says "Rod..  you must READ DATA before you can use it"..
  150.  
  151.  MC> Instead, I got frustrated because attempting to read from track 80 on a 1571 didn't result in a flashing red light on my drive.
  152.  
  153. Thats because you are reading the DRIVE MEMORY, not the DISK.. The flashing light indicates a DISK error.
  154.  
  155.  MC> Perhaps I abandoned this strategy just a little bit too soon!
  156.  
  157. Probably,  but what the heck, it helps to experiment and try different things anyway.
  158.  
  159.  MC> Reading an error channel is probably the one thing I need most to practice - especially since I'm now writing softare with Loadstar in
  160.  
  161. I agree, but NOT because you are planning it for LS,  do it because not only is it the correct thing to do, and the safe thing to do...  do it because it is essential...   *especially* when you are planning on modifying disk directorys..  you CANNOT afford to skimp on error checking when dealing with such a "sensitive" area of the disk.
  162.  
  163.  MC> RG> At least one of the versions of QWKRR used this method, for pretty much the same reasons that you want it.
  164.  
  165.  MC> Ah, so even though it's a "brute force" tactic it still passes as a correct method for acquiring the desired information.  Good!  It makes
  166.  
  167. When it comes to programming there isn't really any such thing as an INCORRECT method of aquiring information (I'm sure some will dissagree).  Not all methods are good practice, but if it works, its a valid method.
  168.  
  169.  MC> me feel good to know that I can at least think along correct paths like this without first requiring outside help.  Now if I just wouldn't
  170.  
  171. STAY WITH THIS.    Asking for help will only get you known, tried and true methods, and while this is often a good thing, it can also limit you...  it was only because I didn't know that reading QWK mail "couldn't be done" on a commodore that enabled me to do it.  I know this sounds "weird", but its true..  before I had regular access to this echo, there were (apparently) many discussions as to why it wasn't possible for a C= to do this, so no one ever really tried..  I was isolated from these discussions, and managed to obtain the file structure for the mail packets...  it didn't take me long at all before I had my first rudimentary OLR (written in BASIC)..  I was REALLY surprised when I discovered this echo and realised I'd acheived what people were saying couldn't be done...   Anyway, the point is, don't be afraid to experiment and try new ideas.. give yourself the freedom to go where no man has gone before..
  172.  
  173.  MC> RG> drive in Native mode, and in this case the directory is on track#1, sector#1,
  174.  
  175.  MC> Other than that are there any differences between way the directory track information of a CMD native mode partition is handled compared to the way the original Commodore drives do it?  If not, that's good
  176.  
  177. No, not really...  but since the CMD drives can date stamp their files there are differences that you should consider..  Such date stamps are stored in bytes 23-27 of each of the file entries.. Bytes 22-25 are usually "unused", and bytes 26-27 are normally used for the track/sector when saving a file with save-with-replace..   CMD have modified these routines in thier drives though, so these bytes are also unused..  except for the date stamp.
  178.  
  179.  MC> RG> I gather that you are aware that Loadstar has several "requirements" of programs it purchases?  If not then I suggest you
  180.  
  181.  MC> My wife and I actually visited Fender's and Jeff's offices (way up there in the clouds over Shreveport) in September when we were on vacation.  I can't recall them mentioning any specific "requirements"
  182.  
  183. Did you ask ?
  184.  
  185.  MC> multiple IF...THEN statements when it comes to checking the values of keys being pressed when menu options are given. I pay great heed to all of the above as I write program(s) for submission to them.
  186.  
  187.  MC> What else have I not listed?
  188.  
  189. I dunno, its been a long time since I saw the list...  I thought there was one that specified that the program needs to reload Loadstar itself when exiting..     Don't forget that these are only guidelines though.. the better the program, the more they are likely to accept it even if the guidelines aren't followed.
  190.  
  191.  
  192.  MC> Am I on the right track regarding the "requirements" to which you allude?
  193.  
  194. Yup.
  195.  
  196. ------------------------ 
  197. 1581 info required
  198.  
  199. From : Rod Gasson
  200.  
  201.    Hopefully someone here can help me.
  202.  
  203. I'm looking for the memory location in a 1581 disk-drive that holds the buffer number for the LAST sector read (IE, the currently active buffer).
  204.  
  205. Up until now I have been using location $6c for this, but this has turned out to be unreliable when more than one file is opened.
  206.  
  207. I ran into a similar problem a while ago on the 1541/71..  I was using $f9, but this too was unreliable with more than one file open.. I have since found that $3f is a more reliable location.  Unfortunetly I've had no success in finding a similar location on the '81
  208.  
  209.  
  210. Anyway, since I've been dabbling with this stuff, for anyone that is interested, I've got determined that the active buffer in the following drives can be found at :
  211.  
  212.  
  213. Drive           Buffer location
  214.  
  215. 1541/71         $3f 
  216. Ramlink         $62 
  217. Ramdrive        $62 
  218. CMD HD          $d3 
  219. CMD FD          $6c 
  220. 1581             ??
  221.  
  222.  
  223. Oh, one thing that I've found of interest.. the location $6c on a JiffyDossed 1581 does return the correct buffer#, but with JD disabled it is only correct about 80% of the time (at a guess).
  224.  
  225. Also, if anyone can confirm that the locations I have for the CMD drives are correct (or not) I'd greatly appreciate it 'cos I found them only by experimentation.
  226.  
  227. ----------------------- 
  228. Peripherals Wanted
  229.  
  230. From : Rod Gasson
  231.  
  232. To   : John Larkin
  233.  
  234. Hi John,
  235.  
  236.    I'm Playing Devils Advocate here..
  237.  
  238. ...Whilst speaking to Ryan Nash-Arjoon, you said:
  239.  
  240.  JL> Cassette software was the curse of the C-64!
  241.  
  242. I disagree.  Cassette software was readily available and cheap, and required a minimum of hardware to access it. If it weren't for cassettes the C64 probably wouldn't have enjoyed the success that it had.
  243.  
  244.  JL> It spawned too many cheesy games
  245.  
  246. It also spawned some classics.
  247.  
  248.  JL> because companies had to try and make the game load all in one shot.
  249.  
  250. There was no technical reason why this had to be this way though.. Admittedly there would be some limitations that disks don't have, but there is still no reason for the entire program to be in memory at once. Personally I prefer a single part program over a multi-part one anyway. The tend to play better.  Mind you, I'm also the kind of person that rarely plays computer games anyway.
  251.  
  252.  JL> This is how crap like Outrun and Space Harrier got made.
  253.  
  254. I don't think I've seen Space Harrier, but I have played Outrun, and I can only say that for a game that had its origins as a "crap" tape game it did kind of well for someone to consider porting it to 16bit arcade games machines.
  255.  
  256.  JL> I used a datasette for the first year I had the C-64 and I *HATED* it.
  257.  
  258. Thats ok,  for a lot of people it is datasette or nothing. I've had both, and I'll take the datasette anytime, thank you.
  259.  
  260.  JL> Programs took forever to load and I
  261.  
  262. As a general rule this is true, but with turbo tape loaders some games will load faster from tape than the same game from the stock 1541.
  263.  
  264.  JL> always had trouble finding the one I wanted off the tape. I usually ended up
  265.  
  266. That is YOUR problem, not a fault of the tape ;-)
  267.  
  268.  JL> using the trick where you stop it halfway through the loading process while it's reading the second copy, just
  269.  
  270. I never used this trick..  I never used a datasette for long enough to learn it.
  271.  
  272.  JL> to speed it up. I own exactly ONE commercial game on tape and it takes about 15 minutes to load, WHEN it loads!
  273.  
  274. There are several cartridges available that will let you capture tape programs so they can be loaded from disk. If its a game you like then thats prolly the best thing to do.
  275.  
  276.  JL> Maybe without cassettes, there wouldn't have been as many C-64's sold, but
  277.  
  278. Thats what I said at the start.
  279.  
  280.  JL> without cassettes, maybe there wouldn't have been as many games that were compromised so that the authors could cram everything into memory at once instead of making each level the best it could be.
  281.  
  282. Have you never considered that some of the games are BETTER because of this..  it teaches the authors to write small and efficient code to fit in the limited amount of memory..  Look at all the crappy disk based programs there are around that have made use of multipart loading, but all you get from it is a lot of pretty graphics, a lot of music, but very little "playable" content.
  283.  
  284.  JL> Also, British games wouldn't work correctly in the US because they'd be in PAL mode and the US uses NTSC.
  285.  
  286. This has little to do with them being tape based programs..  Most tape based programs that I've seen haven't been "advanced" enough to take full advantage of FLI graphics etc where things become time critical. Having said that though, I can see problems with LOADING these programs saved on a tape recorded in an NTSC country..  the reason being that the datasette itself runs at a slightly different speed..  how critical this is I wouldn't know.
  287.  
  288. ------------------------- 
  289. From : RYAN NASH-ARJOON 
  290.  
  291. To   : JOHN LARKIN 
  292.  
  293. Subj : Cassette Software
  294.  
  295. Hi John
  296.  
  297. Some cassette games for the 64 were crap, but are you saying all "disk only" games were brilliant?
  298.  
  299. As for cassette software being responsible for the whole genre of second rate games I have to disagree. The two games you mentioned were converted from arcade machines. In reality it is foolish to expect a faithful conversion of a 16 bit arcade game to a 64K 8 bit home computer, but every time one came out we would always hope that it would be exactly like the original arcade machine.
  300.  
  301. Having said that, when it comes to *arcade* conversions cassette or disk media really has nothing to do with it. In my opinion *arcade* conversions have *always* turned out pretty badly. Gauntlet and Commando were also scraping the bottom of the barrel. The reason why the "crap like Outrun and Space Harrier got made" is because the companies were more interested in recovering their expenses paid for buying the rights or "Official License" of the game from the arcade company. Coupled with the limitations of the 64 the actual quality of the conversion is bound to take a back seat.
  302.  
  303. As for companies having to make a game load in one shot, that's not true. Off the top of my head take a look at the Epyx series of Summer Games, Winter Games etc. They were designed for disk, but are extremely playable on cassette. And there's no hard and fast rule saying that *all* cassette games have to be identical to their disk counterparts: look at Microprose's Gunship. This game was originally designed for disk and is a complex multi-loader. Because of the complexity of the multiload, the cassette version had to omit parts of the game.
  304.  
  305. I'm originally from the UK, but I can tell you that Disk Drives were damn expensive. They would cost the same as the 64 itself, and I paid <250 (about $375) for my 64C in 1987. Cassette software would cost <10 ($15) and disk software (near impossible to find) would cost at least <15 ($23). Many of us never had the opportunity to use a disk drive, so we weren't going to miss something we had never experienced in the first place! The Datasette provided with the 64 was what we were used to using. Quite simply, in 1987 disk drives were considered an unnecessary luxury, and waiting 5 minutes or so for a game to load was more than acceptable. If somebody didn't like the wait then they should find another hobby!
  306.  
  307. When the 64 first came out, the cassette software *would* take forever to load (about 20 minutes or so). But those games are really old and now very rare. Most of the newer games (from say 1986 onwards) used Turbo/Nova/Pav etc loaders and would cut the load time to just 5 minutes! From 1986 the actual quality of games increased too!
  308.  
  309. Why didn't you make a note of the tape counter readings before each program starts? That's what I do and it saves me a heck of a lot of time!
  310.  
  311. JL> Maybe without cassettes, there wouldn't have been as many C-64's sold, but without cassettes, maybe there wouldn't have been as many games that were compromised so that the authors could cram everything into memory at once instead of making each level the best it could be.
  312.  
  313. I dunno. But I do know that the 64 was a mega popular machine in the UK and not many of us had disk drives.
  314.  
  315. Like I said earlier, just because a game is on cassette doesn't mean it has to load in one shot. There are many cassette multi-load games: the Epyx series of Summer Games, Winter Games, World Games, Summer Games II, Infiltrator, Leaderboard, The Fourth Protocol, Super Cycle, Hardball to name just a few!!!
  316.  
  317. JL> Also, British games wouldn't work correctly in the US because they'd be in PAL mode and the US uses NTSC.
  318.  
  319. It's just as well I have a European and US 64!! I also have a European Vic20 and it still works!!
  320.  
  321. -----------------------
  322.  
  323.  
  324.